package com.papper.mng.dialect;

import com.papper.mng.dialect.tag.PaEnumSelectTag;
import com.papper.mng.dialect.tag.PaEnumStyleTag;
import com.papper.mng.dialect.tag.PaSuggestTag;
import org.springframework.stereotype.Component;
import org.thymeleaf.dialect.AbstractProcessorDialect;
import org.thymeleaf.processor.IProcessor;

import java.util.HashSet;
import java.util.Set;

/**
 * @Author:Lajiao
 * @Date:2014年8月21日
 * @Time:下午12:30:20
 * @Description:页面自定义标签
 */
@Component
public class PapperDialect extends AbstractProcessorDialect {
    private static final String DIALECT_NAME = "页面自定义标签";
    private static final String PREFIX_NAME  = "pa";
    public static final  int    PRECEDENCE   = 10000;

    public PapperDialect() {
        super(DIALECT_NAME, PREFIX_NAME, PRECEDENCE);
    }

    @Override
    public Set<IProcessor> getProcessors(String dialectPrefix) {
        Set<IProcessor> processors = new HashSet<IProcessor>();
        // 添加自定义标签-pa.enumStyle
        processors.add(new PaEnumStyleTag(PREFIX_NAME));
        // 添加自定义标签-pa.enumSelect
        processors.add(new PaEnumSelectTag(PREFIX_NAME));
        // 添加自定义标签-pa.suggest
        processors.add(new PaSuggestTag(PREFIX_NAME));
        return processors;
    }
}
